import request from "@/utils/request";

export function fetchList(query) {
    return request({
        url: "/preserve/api/preserveItem/query/page",
        method: "get",
        params: query
    });
}

//保存
export function saveInfo(query) {
    if (query.id) {
        return request({
            url: "/preserve/api/preserveItem",
            method: "put",
            data: query //单条操作
        });
    } else {
        return request({
            url: "/preserve/api/preserveItem",
            method: "post",
            data: query //单条保存
        });
    }
}
//详细信息
export function fetchDetailInfo(query) {
    return request({
        url: "/preserve/api/preserveItem/query/" + query,
        method: "get"
    });
}
//导出
export function exportFile(params) {
    return request({
        url: "/device/api/device/exportExcel",
        method: "get"
    });
}
//下载批量导入模板

export function downloadTemplete(query) {
    return request({
        url: "/preserve/api/preserveItem/download/template",
        method: "get",
        params: query
    });
}
//批量导入
export function importFile() {
    return request({
        url: "/preserve/api/preserveItem/import",
        method: "post"
            //data: params
    });
}
//删除台账
export function deleteDeviceInfo(query) {
    return request({
        url: `/preserve/api/preserveItem/${query}`,
        method: "delete"
            // data: [query] //批量删除
    });
}
//启用
export function startUserInfo(query) {
    return request({
        url: "/user/api/user/start/" + query,
        method: "put"
            //data: query
    });
}
//停用
export function stopUserInfo(query) {
    return request({
        url: "/user/api/user/stop/" + query,
        method: "put"
            //data: query
    });
}
export function getGroups() {
    return request({
        url: "/preserve/api/preserveItemGroup/query/list",
        method: "get"
            //data: query
    });

}